package org.dromara.common.core.domain.model

import jakarta.validation.constraints.NotBlank

/**
 * 三方登录对象
 *
 *@author LikeYouDo
 *@date 2025/1/5 16:52
 */
data class XcxLoginBody(
    /**
     * 小程序id(多个小程序时使用)
     */
    var appid: String? = null,

    /**
     * 小程序code
     */
    var xcxCode: @NotBlank(message = "{xcx.code.not.blank}") String? = null,
) : LoginBody() {
    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (other !is XcxLoginBody) return false
        if (!super.equals(other)) return false

        if (appid != other.appid) return false
        if (xcxCode != other.xcxCode) return false

        return true
    }

    override fun hashCode(): Int {
        var result = super.hashCode()
        result = 31 * result + (appid?.hashCode() ?: 0)
        result = 31 * result + (xcxCode?.hashCode() ?: 0)
        return result
    }
}
